#include <Util/Engine/BSDF.h>

#include <Util/Basic/UGM/Mat3x3.h>

#include <Util/Basic/Math.h>

using namespace Util;
using namespace Util::Basic;
using namespace Util::Engine;

const Normalf BSDF::TangentSpaceNormalToWorld(const Normalf & worldTangent, const Normalf & worldNormal, const Normalf & tangentSpaceNormal) {
	const Normalf bitangent = worldTangent.Cross(worldNormal);
	Mat3f TBN(worldTangent, bitangent, worldNormal);
	return (TBN * tangentSpaceNormal).Normalize();
}
